#!/usr/bin/env python

__author__ = "wpplx"
__version__ = "1.0"
__date__    ="2007.12.30"

def caculator(salary,base):
    tax = 0
    if salary <= base :
        tax = 0
    elif salary > base and salary <= base + 500:
        tax = (salary - base)*0.05
    elif salary > base+500 and salary <= base+2000:
        tax = 25 + (salary-base-500)*0.1
    elif salary > base + 2000 and salary <= base+5000:
        tax = 175 + (salary-base-2000)*0.15
    elif salary > base+5000 and salary <= base+20000:
        tax = 625 + (salary-base-5000)*0.2
    elif salary > base+20000 and salary <= base+40000:
        tax = 3625 + (salary-base-20000)*0.25
    elif salary > base+40000 and salary <= base+60000:
        tax = 8625 + (salary-base-40000)*0.3
    elif salary > base+60000 and salary <= base+80000:
        tax = 14625 + (salary-base-60000)*0.35
    elif salary > base+80000 and salary <= base+100000:
        tax = 21625 + (salary-base-80000)*0.4
    else:
        tax = 29625 + (salary-base-100000)*0.45
    return tax

if __name__ == '__main__':
    x = 21000
    base=2000
    y = caculator(x,base)
    print 'tax is ',y
